<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'input_hotel.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/application.css"></c:url>">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/listdata.css"></c:url>">
    
 <script type="text/javascript">
         
         function updateHotel(hotelId){
            location.href="<c:url value="/HotelMgr?act=preModify"/>&hotelId="+hotelId;
         }
         
         function removeHotel(hotelName,hotelId){
         
            if(confirm("您确认要删除分店【"+hotelName+"】吗？")){
               location.href="<c:url value="/HotelMgr?act=remove"/>&hotelId="+hotelId;
            }
            
         }
    
    </script>
  </head>
  
  <body>
    <div class="listTitle"> 
      >> 酒店列表
     </div>
     <c:if test="${not empty hotels}">
     <table class="listable" cellspacing=0 cellpadding=0 border=0>
		      <thead>
		         <tr>
		           <th>分店编号</th>
		           <th>分店名称</th>
		           <th>分店地址</th> 
		           <th>分店电话</th>
		           <th>房间总数</th> 
		           <th>相关操作</th>        
		         </tr>
		      </thead>
		      <tbody>
		         <c:forEach var="hotel" items="${hotels}">
		            <tr>
		            <td>${hotel.hotelId}</td>
		              <td>${hotel.hotelName}</td>
		              <td>${hotel.hotelAddress}</td>
		              <td>${hotel.hotelPhone}</td>
		              <td>${hotel.roomAccount}</td>
		              <td>
		                <span title="点击修改[${hotel.hotelName}]酒店信息" class="linkSpan" onclick="updateHotel(${hotel.hotelId});">修 改</span> &nbsp;
		                <span title="点击删除[${hotel.hotelName}]酒店信息" class="linkSpan" onclick="removeHotel('${hotel.hotelName}',${hotel.hotelId});">删 除</span>
		              </td>	              	              	              	              
		            </tr>
		         </c:forEach>
		      </tbody>
	 </table>
	 </c:if>
     
     <c:if test="${empty hotels}">
           <center>
	        <div id="noRecord" style="margin-top:80px;width:30%;height:70px;border:1px solid #c1cdd8;text-align:center;">
	          <span style="margin-top:20px;color:red;">没有符合条件的酒店分店信息被找到!</span>
	          <br/>
	          <br/>
	          <button onclick="history.go(-1);"> 返 回 </button>
	        </div>
	       </center>	  
     </c:if>
     <c:if test="${not empty errMsg}">
          <script type="text/javascript">
             alert("${errMsg}");
          </script>
          <c:remove var="errMsg"/>
       </c:if>
  </body>
</html>
